package com.zyh.blogs.service;

import com.zyh.blogs.dao.ArticleRepository;
import com.zyh.blogs.entity.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    ArticleRepository articleRepository;

    @Override
    public Page<Article> queryList(int page, int size) {

        Pageable pageable = PageRequest.of(page, size);
        Page<Article> all = articleRepository.findAll(pageable);
        return all;
    }
}
